<?php

/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4 fdm=marker: */

/**
 * LightBot
 *
 * LICENSE
 *
 * This source file is subject to the new BSD license that is bundled
 * with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://framework.zend.com/license/new-bsd
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@zend.com so we can send you a copy immediately.
 *
 * @category  LightBot
 * @package   default
 * @copyright Copyright (c) 2008 Olivier Hoareau <hoareau.olivier@gmail.com>
 * @author    Olivier Hoareau <hoareau.olivier@gmail.com>
 * @license   License http://framework.zend.com/license   New BSD License
 * @version   $Id:$
 */

// retrieve the path of the configuration file
$confFile = null;

for($i=1;$i<count($argv);$i++){
    if(substr($argv[$i],0,7)==='--conf=') {
        $confFile = substr($argv[$i],7);
    }elseif(substr($argv[$i],0,15)==='--include-path=') {
        set_include_path(get_include_path().PATH_SEPARATOR.substr($argv[$i],15));
    }
}

if($confFile===null) {
    echo "Use option --conf=<path/to/your/configuration/file.ini>\n";
    exit;
}

// imports LightBot
require dirname(__FILE__) . '/../' . 'library/LightBot/LightBot.php';

// instantiates and runs LightBot
try {
    $bot = new LightBot_LightBot();
    $bot->configure($confFile);
    $bot->run();
} catch(Exception $e) {
    echo "Error: ".$e->getMessage()."\n";
    exit;
}

/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * c-hanging-comment-ender-p: nil
 * End:
 */
